<?php
header('content-type:text/html;charset=utf-8');
//环视的例子
//正前瞻?=
$subject='helloworld';
$pattern='#hello(?=world)#';
preg_match($pattern,$subject,$matches);
print_r($matches);
echo '<hr/>';
//反前瞻?!
$subject='helloa';
$pattern='#hello(?!world)#';
preg_match($pattern,$subject,$matches);
print_r($matches);
echo '<hr/>';
//正后顾?<=
$subject='helloworld';
$pattern='#(?<=hello)world#';
preg_match($pattern,$subject,$matches);
print_r($matches);
echo '<hr/>';
//反后顾?<!
$subject='halloworld';
$pattern='#(?<!hello)world#';
preg_match($pattern,$subject,$matches);
print_r($matches);
echo '<hr/>';
//注释
$subject='124334';
$pattern='/\d(?#this is a comment)/';
preg_match($pattern,$subject,$matches);
print_r($matches);




